#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
#  
#  
# Licensed Materials - Property of IBM 
#  
# (C) COPYRIGHT International Business Machines Corp. 2000,2002 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 

# "@(#)09   1.6   src/rsct/rm/ER/wallevent, ERrm, rsct_rori, roris01a 3/11/02 16:04:46";

#####################################################################
#
# Name:    wallevent
#
# Purpose: Broadcast a message to the console to notify all the 
#          logged-in of an event or a rearm event
#
# Inputs:  None
#
#####################################################################

# main()

PERL=/usr/sbin/rsct/perl5/bin/perl

CTMSG=/usr/sbin/rsct/bin/ctdspmsg
MSGMAPPATH=/usr/sbin/rsct/msgmaps
export MSGMAPPATH

Usage=`$CTMSG script IBM.ERrm.cat MSG_SH_USAGE`

while getopts ":h" opt
do
  case $opt in

    h ) print "Usage: `basename $0` [-h] "
        exit 0;;

    ? ) print "Usage: `basename $0` [-h] "
        exit 3;;
  esac
done

# convert time string
seconds=${ERRM_TIME%,*}

EventTime=$(seconds=$seconds $PERL -e \
'
use POSIX qw(strftime);
print strftime("%A %D %T", localtime($ENV{seconds}) );  

'
)

WallMsg=`$CTMSG script IBM.ERrm.cat MSG_SH_WALLN "$ERRM_COND_SEVERITY" "$ERRM_TYPE" "$ERRM_COND_NAME" "$ERRM_RSRC_NAME" "$ERRM_RSRC_CLASS_NAME" "$EventTime" "$ERRM_NODE_NAME" "$ERRM_NODE_NAMELIST"`

wall "${WallMsg}"


#wall "$ERRM_COND_SEVERITY $ERRM_TYPE occurred for the condition $ERRM_COND_NAME on the resource $ERRM_RSRC_NAME of the resource class $ERRM_RSRC_CLASS_NAME at $EventTime on $ERRM_NODE_NAME" 


